package com.cnswhy.cloud.server.core.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableName;
import com.cnswhy.cloud.common.core.base.entity.Entity;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;

import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import com.cnswhy.cloud.server.common.entity.enumeration.TransType;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 
 * </p>
 *
 * @author cnswhy
 * @since 2020-10-14
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("t_wallet_trans_dtl")
@ApiModel(value = "WalletTransDtl", description = "")
@AllArgsConstructor
public class WalletTransDtl extends Entity<Long> {

    private static final long serialVersionUID = 1L;

    /**
     * 客户ID
     */
    @ApiModelProperty(value = "客户ID")
    @NotNull(message = "客户ID不能为空")
    @TableField("customer_wallet_id")
    @Excel(name = "客户ID")
    private Long customerWalletId;

    /**
     * 钱包类型 #TransType{WITHDRAW:提现;CHARGE:充值;}
     */
    @ApiModelProperty(value = "钱包类型 #TransType{WITHDRAW:提现;CHARGE:充值;}")
    @NotNull(message = "钱包类型 #TransType{WITHDRAW:提现;CHARGE:充值;}不能为空")
    @TableField("trans_type")
    @Excel(name = "交易类型", replace = {"提现_WITHDRAW",
            "充值_CHARGE", "分享充值_SHARE_CHARGE",
            "分享转账_SHARE_TRANSFER", "拼购券充值_COUPON_CHARGE",
            "拼购券转账_COUPON_TRANSFER", "拼团收益_SPELL_BALANCE_CHARGE",
            "拼团值收益_SPELL_VALUE_CHARGE", "拼团收益转账_SPELL_BALANCE_TRANSFER",
            "贡献收益充值_CONTRIBUTION_BALANCE_CHARGE", "贡献收益转账_CONTRIBUTION_BALANCE_TRANSFER",
            "队长分红_TEAM_BALANCE_CHARGE", "队长分红转账_TEAM_BALANCE_TRANSFER",
            "贡献收益_CONTRIBUTION", "爱心收益转账_LOVE_BALANCE_TRANSFER",
            "爱心收益充值_LOVE_BALANCE_CHARGE", "爱心收益回收_LOVE_BALANCE_RECYCLE",
            "平台回购充值_BACK_ORDER_CHARGE", "拼团_SPELL_ORDER", "商城购买_SHOP_ORDER",
            "拼团失败_SPELL_ORDER_FAILURE","分润_SPLIT","回收_RECYCLE",
            "拼团_SPELL_ORDER","平台回购充值_BACK_ORDER_CHARGE",
            "消费分红_CONSUME_BALANCE_CHARGE",  "_null"})
    private TransType transType;

    /**
     * 交易系统订单号
     */
    @ApiModelProperty(value = "交易系统订单号")
    @NotEmpty(message = "交易系统订单号不能为空")
    @Length(max = 32, message = "交易系统订单号长度不能超过32")
    @TableField(value = "trans_order_id", condition = LIKE)
    @Excel(name = "交易系统订单号")
    private String transOrderId;

    /**
     * 可用余额
     */
    @ApiModelProperty(value = "可用余额")
    @NotNull(message = "可用余额不能为空")
    @TableField("begin_bal")
    @Excel(name = "可用余额")
    private Long beginBal;

    /**
     * 可用余额
     */
    @ApiModelProperty(value = "可用余额")
    @NotNull(message = "可用余额不能为空")
    @TableField("ded_bal")
    @Excel(name = "可用余额")
    private Long dedBal;

    /**
     * 可用余额
     */
    @ApiModelProperty(value = "可用余额")
    @NotNull(message = "可用余额不能为空")
    @TableField("end_bal")
    @Excel(name = "可用余额")
    private Long endBal;

    /**
     * 清算日期
     */
    @ApiModelProperty(value = "清算日期")
    @TableField(value = "sett_date", condition = LIKE)
    @Excel(name = "清算日期")
    private String settDate;

    @ApiModelProperty(value = "拼团订单")
    @TableField(value = "spell_order_id", condition = LIKE)
    @Excel(name = "拼团订单")
    private String spellOrderId;

    @ApiModelProperty(value = "拼团人账号")
    @TableField(value = "split_from", condition = LIKE)
    @Excel(name = "拼团人账号")
    private String splitFrom;
    @ApiModelProperty(value = "分润级别")
    @TableField(value = "split_level")
    @Excel(name = "分润级别")
    private Integer splitLevel;
    @ApiModelProperty(value = "客户ID")
    @NotNull(message = "客户ID不能为空")
    @TableField("customer_id")
    @Excel(name = "客户ID")
    private Long customerId;

    @Builder
    public WalletTransDtl(Long id, LocalDateTime createTime, LocalDateTime updateTime, Long createUser, Long updateUser, 
                    Long customerWalletId, TransType transType, String transOrderId, Long beginBal, Long dedBal, Long endBal, String settDate, String spellOrderId, String splitFrom,Integer splitLevel,Long customerId) {
        this.id = id;
        this.createTime = createTime;
        this.updateTime = updateTime;
        this.createUser = createUser;
        this.updateUser = updateUser;
        this.customerWalletId = customerWalletId;
        this.transType = transType;
        this.transOrderId = transOrderId;
        this.beginBal = beginBal;
        this.dedBal = dedBal;
        this.endBal = endBal;
        this.settDate = settDate;
        this.spellOrderId = spellOrderId;
        this.splitFrom = splitFrom;
        this.splitLevel = splitLevel;
        this.customerId = customerId;
    }

}
